<extend name="Layout:layout_list" />
<block name="body_content_block">
    <table id="main_grid" class="easyui-datagrid" data-url="{:AddonU('IncomingCall/get_rule_list_json')}"></table>
    <div id="tb" style="padding:2px 5px;">
        <div style="margin-bottom: 5px; border-bottom:solid 1px #dddddd;">
            <if condition="equal_permission_name('新增来话导航',$loginData['role_id'])">
                <a href="{:AddonU('IncomingCall/rule_edit')}" class="easyui-linkbutton lnk_grid_add" iconCls="icon-add" plain="true">新增</a>
            </if>

            <if condition="equal_permission_name('编辑来话导航',$loginData['role_id'])">
                <a href="{:AddonU('IncomingCall/rule_edit','id=varid')}" class="easyui-linkbutton lnk_grid_edit" iconCls="icon-edit" plain="true" data-title="编辑 {name}">编辑</a>
            </if>            
            <if condition="equal_permission_name('删除来话导航',$loginData['role_id'])">
                <a href="{:AddonU('IncomingCall/rule_delete','id=varid')}" class="easyui-linkbutton lnk_grid_remove" iconCls="icon-remove" plain="true">删除</a>
            </if>
        </div>
    </div>
    <!--隐藏区域-->
    <div style="display:none">
        <!--表格查询对话框-->
        <div id="dlg_search" style="padding:10px">
            <form method="get" action="{:AddonU('IncomingCall/get_rule_list_json')}" data-export-url="{:AddonU('IncomingCall/rule_export')}">
                <if condition="$isSuperAdmin">
                    租户：<input type="text" name="siteID" id="siteID" class="easyui-combobox" data-url="{:AddonU('Admin/get_admin_json')}" />
                    <else/>
                    <input type="hidden" name="siteID" value="{$loginData.siteID}"/>
                </if>
            </form>
        </div>
        <!--/表格查询对话框-->
    </div>
    <!--/隐藏区域-->
</block>
<block name="body_after_block">
    <script type="text/javascript">
        // 页面初始化
        var curd_grid = CurdGrid.newInstance();
        curd_grid.before_search_dialog = function () {
            $('#siteID').combobox({url: $('#siteID').data('url'), valueField: 'id', textField: 'text'});
        }
        curd_grid.config({
            title: '来话导航管理',
            toolbar: '#tb',
            columns: [[
                    {field: 'ck', checkbox: true},
                    {title: "租户ID", field: "siteIDText", sortable: true},
                    {title: "导航名称", field: "name", sortable: true},
                    {title: "中继名称", field: "trunkName", sortable: true},
                    {title: "主叫号码", field: "callerNo", sortable: true},
                    {title: "被叫号码", field: "calledNo", sortable: true, width: 310, formatter: function (value) {
                            return '<div class="breakline">' + value + '</div>';
                        }},
                    {title: "录音标识", field: "recStateText", sortable: true},
                    {title: "播放工号", field: "sayExtensionText", sortable: true},
                    {title: "放音文件", field: "musicText", sortable: true},
                    {title: "放音次数", field: "musicLimit", sortable: true},
                    {title: "导航动作", field: "outOperText", sortable: true},
                    {title: "动作参数", field: "outParamText", sortable: true},
                    {title: "评价", field: "outEcEnableText", sortable: true},
                    {title: "日期类型", field: "dateTypeText", sortable: true},
                    {title: "开始时间", field: "beginTime", sortable: true},
                    {title: "结束时间", field: "endTime", sortable: true},
                    {title: "编号", field: "id", hidden: true},
                ]],
        });
        curd_grid.init();
    </script>
</block>